//
//  ChosePeopleLayer.cpp
//  identist
//
//  Created by Denveryee on 14-3-22.
//
//
#include "ChosePeopleLayer.h"
#include "BeginLayer.h"

static float peoplePostions[][2] =
{
    {394, 624},
    {392, 621},
    {392, 612},
    {400, 634},
    {390, 634},
    {397, 642}
};

static float peopleSize[][2] =
{
    {415, 450},
    {357, 465},
    {406, 493},
    {382, 473},
    {405, 458},
    {380, 463}
};

static float peopleBlackSize[][2] =
{
    {415, 450},
    {357, 465},
    {406, 493},
    {371, 462},
    {384, 434},
    {380, 463}
};

ChosePeopleLayer::ChosePeopleLayer(){
    height = 1500;
    shopHeight = 1500;
    beforeOffset = -630;
}

ChosePeopleLayer::~ChosePeopleLayer(){
    
}

bool ChosePeopleLayer::init()
{
    bool pRet = false;
    
    do {
        CC_BREAK_IF(!CCLayer::init());
        
        /******************************chose people layer begin********************/
        CCSprite *bg = CCSprite::create("chosePeopleLayer/chose_people_layer_bg_400_640.png");
        bg->setPosition(ccp(400, 640));
        addChild(bg);
        
        CCSprite *shine = CCSprite::create("chosePeopleLayer/chose_people_layer_bg_shine_412_808.png");
        shine->setPosition(ccp(412, 808));
        addChild(shine);

        shine->runAction(CCRepeatForever::create(CCRotateBy::create(10, 360)));
        
        CCSprite* addMoneyBg = CCSprite::create("chosePeopleLayer/chose_people_add_money_bg_619_62.png");
        addMoneyBg->setPosition(ccp(619, 1280-62));
        addChild(addMoneyBg);
        
        //@TODO 用户财富
        CCLabelTTF* labelMoney = CCLabelTTF::create("999999", "STHupo", 40);
        labelMoney->setAnchorPoint(ccp(0, 0));
        labelMoney->setPosition(ccp(592, 1280-84));
        addChild(labelMoney);
        
        CCMenuItem* backBtn = CCMenuItemImage::create("chosePeopleLayer/chose_people_back_n_55_63.png", "chosePeopleLayer/chose_people_back_p_55_63.png", this, menu_selector(ChosePeopleLayer::menuBackCallback));
        backBtn->setPosition(ccp(55, 1280-63));
        
        CCMenuItem* addMoneyBtn = CCMenuItemImage::create("chosePeopleLayer/chose_people_add_money_n_btn_754_62.png", "chosePeopleLayer/chose_people_add_money_p_btn_754_62.png", this, menu_selector(ChosePeopleLayer::menuAddMoenyCallback));
        addMoneyBtn->setPosition(ccp(756, 1280-62));
        
        menuPlay = CCMenu::create(backBtn, addMoneyBtn, NULL);
        menuPlay->setPosition(CCPointZero);
        this->addChild(menuPlay);
        
        UILayer *uLayer = UILayer::create();
        // Create the page view
        pageView = UIPageView::create();
        pageView->setTouchEnabled(true);
        pageView->setSize(CCSizeMake(800, 1280));
        pageView->setAnchorPoint(ccp(0.5f, 0.5f));
        pageView->setPosition(ccp(400, 640));
        
        for (int i = 0; i < PAGE_SUM_NUM; ++i)
        {
            UILayout* layout = UILayout::create();
            layout->setSize(CCSizeMake(800 , 1280));
            
            UIImageView* woodBg = UIImageView::create();
            woodBg->setTouchEnabled(true);
            woodBg->setScale9Enabled(true);
            woodBg->loadTexture("chosePeopleLayer/chose_people_wood_bg_400_617.png");
            woodBg->setAnchorPoint(ccp(0.5f, 0.5f));
            woodBg->setSize(CCSizeMake(524, 663));
            woodBg->setPosition(ccp(400, 1280-617-60));
            layout->addChild(woodBg);
            
            addChosePeople(layout, i, false);
            
            m_pImgLight[i] = UIImageView::create();
            m_pImgLight[i]->setSize(CCSizeMake(33, 33));

            if( 0 == i )
            {
                m_pImgLight[i]->loadTexture("chosePeopleLayer/chose_people_current_298_1103.png");
            }
            else
            {
                m_pImgLight[i]->loadTexture("chosePeopleLayer/chose_people_no_current_298_1103.png");
            }
            m_pImgLight[i]->setPosition(ccp(400-32 + (i-2)*64, 1280-1103));
            
            UIImageView* star = UIImageView::create();
            star->setTouchEnabled(true);
            star->setScale9Enabled(true);
            star->loadTexture("chosePeopleLayer/chose_people_star_278_851.png");
            star->setAnchorPoint(ccp(0.5f, 0.5f));
            star->setSize(CCSizeMake(73, 71));
            star->setPosition(ccp(278, 1280-851-60));
            layout->addChild(star);
            
            //@TODO 星
            textAddShadow(layout, "12/12", "STHupo", 90, 5, 100, 425, 1280-914, ccBLACK);
            
            pageView->addPage(layout);
            
            uLayer->addWidget(m_pImgLight[i]);
        }
        pageView->addEventListenerPageView(this, pagevieweventselector(ChosePeopleLayer::pageViewEvent));
        
        uLayer->addWidget(pageView);
        addChild(uLayer);
        /******************************chose people layer end********************/
        
        /************************upgade layer begin****************************/
        upgradeLayer = CCLayer::create();
        
        CCSprite* upgradeBg = CCSprite::create("upgradeTool/upgrade_tool_bg_389_631.png");
        upgradeBg->setPosition(ccp(389, 1280-631+height));
        upgradeLayer->addChild(upgradeBg);
        
        CCSprite* upgradeBgTop = CCSprite::create("upgradeTool/upgrade_tool_top_395_152.png");
        upgradeBgTop->setPosition(ccp(395, 1280-152+height));
        upgradeLayer->addChild(upgradeBgTop);
        
        CCSprite* upgradeAddMoneyBg = CCSprite::create("upgradeTool/upgrade_tool_add_money_bg_367_286.png");
        upgradeAddMoneyBg->setPosition(ccp(367, 1280-286+height));
        upgradeLayer->addChild(upgradeAddMoneyBg);
        
        bar = CCSprite::create("upgradeTool/upgrade_tool_right_scrol_bar_698_499.png");
        bar->setPosition(ccp(698, 1280-499+25+height));
        upgradeLayer->addChild(bar);
        
        //@TODO用户财富
        textAddShadowAnchor(upgradeLayer, "99", "STHupo", 50, 5, 100, 289, 1280-338+height, ccBLACK, 0, 0);

        CCMenuItem* upgradeAddMoneyBtn = CCMenuItemImage::create("upgradeTool/upgrade_tool_add_n_btn_547_309.png", "upgradeTool/upgrade_tool_add_p_btn_547_309.png", this, menu_selector(ChosePeopleLayer::upgradeAddMoney));
        upgradeAddMoneyBtn->setPosition(ccp(547, 1280-309+height));
        
        CCMenuItem* closeBtn = CCMenuItemImage::create("upgradeTool/upgrade_tool_close_n_btn_394_1038.png", "upgradeTool/upgrade_tool_close_p_btn_394_1038.png", this, menu_selector(ChosePeopleLayer::upgradeClose));
        closeBtn->setPosition(ccp(394, 1280-1038+height));
        
        CCMenu* menuSetting = CCMenu::create(upgradeAddMoneyBtn, closeBtn, NULL);
        menuSetting->setPosition(CCPointZero);
        upgradeLayer->addChild(menuSetting);
        
        //滚动列表
        UILayer *upgradeUILayer = UILayer::create();
        // Create the scrollview by vertical
        
        UIScrollView* scrollView = UIScrollView::create();
        scrollView->setTouchEnabled(true);
        scrollView->setBounceEnabled(false);
        scrollView->setAnchorPoint(ccp(0.5, 0.5));
        scrollView->setSize(CCSizeMake(745, 600));
        scrollView->setPosition(ccp(389, 1280-650+height));
        scrollView->addEventListenerScrollView(this, scrollvieweventselector(ChosePeopleLayer::scrollEvent));
        upgradeUILayer->addWidget(scrollView);
        
        
        float innerWidth = scrollView->getSize().width;
        
        scrollView->setInnerContainerSize(CCSizeMake(745, 1230));
        
        for(int i=0; i<6; i++){
            UIImageView* upgradeToolBg = UIImageView::create();
            upgradeToolBg->loadTexture("upgradeTool/wood_bg_382_443.png");
            
            float bgX = innerWidth / 2;
            float bgY = scrollView->getInnerContainerSize().height - upgradeToolBg->getSize().height / 2-30 - i*209;
            
            upgradeToolBg->setSize(CCSizeMake(554, 129));
            upgradeToolBg->setPosition(ccp(bgX, bgY));
            scrollView->addChild(upgradeToolBg);
            
            UIButton* buyUpgrade = UIButton::create();
            buyUpgrade->loadTextures("upgradeTool/need_money_bg_566_463.png", "upgradeTool/need_money_bg_566_463.png", "");
            buyUpgrade->setPosition(ccp(bgX+566-382, bgY-(463-443)));
            scrollView->addChild(buyUpgrade);
            
            textAddShadowAnchor(scrollView, "999", "STHupo", 40, 3, 50, bgX+537-382, bgY-40, ccBLUE);
            
            UIImageView* scrollBarBg = UIImageView::create();
            scrollBarBg->loadTexture("upgradeTool/scroll_bar_bg_348_480.png");
            scrollBarBg->setPosition(ccp(bgX-(382-348), bgY-(480-443)));
            scrollView->addChild(scrollBarBg);
            
            UIImageView* scrollBarTitle = UIImageView::create();
            scrollBarTitle->loadTexture("upgradeTool/scroll_bar_title_319_445.png");
            scrollBarTitle->setPosition(ccp(bgX-(382-319), bgY+(445-443)));
            scrollView->addChild(scrollBarTitle);
            
            //@TODO下一级增加的速度
            UILabelAtlas* labelAtlas = UILabelAtlas::create();
            labelAtlas->setProperty("10:", "upgradeTool/scroll_bar_nums.png", 20, 20, "0");
            labelAtlas->setAnchorPoint(ccp(0, 0.5));
            labelAtlas->setPosition(ccp(bgX-(382-319)+105, bgY+(445-443)));
            scrollView->addChild(labelAtlas);
            
            char icon[100];
            UIImageView* toolIicon = UIImageView::create();
            sprintf(icon, "upgradeTool/%d/tool_icon.png", i);
            toolIicon->loadTexture(icon);
            toolIicon->setPosition(ccp(bgX-(382-139), bgY+(449-443)));
            scrollView->addChild(toolIicon);

            char title[100];
            UIImageView* toolTitle = UIImageView::create();
            sprintf(title, "upgradeTool/%d/tool_title.png", i);
            toolTitle->loadTexture(title);
            toolTitle->setAnchorPoint(ccp(0, 0));
            toolTitle->setPosition(ccp(bgX-(382-214), bgY+(443-425)));
            scrollView->addChild(toolTitle);

            char bar[100];
            UILoadingBar* loadingBar = UILoadingBar::create();
            sprintf(bar, "upgradeTool/%d/tool_bar.png", i);
            loadingBar->loadTexture(bar);
            loadingBar->setPercent(i*10);
            loadingBar->setPosition(ccp(bgX-(382-349), bgY-(480-443)));
            scrollView->addChild(loadingBar);

        }
        
        upgradeLayer->addChild(upgradeUILayer);
        addChild(upgradeLayer, 1);
        /************************upgade layer end****************************/
        
        /************************shop layer begin****************************/
        shopLayer = CCLayer::create();
        
        CCSprite* shopBg = CCSprite::create("shopLayer/shop_bg_398_664.png");
        shopBg->setPosition(ccp(398, 1280-664+shopHeight));
        shopLayer->addChild(shopBg);
        
        CCMenuItem* shopCloseBtn = CCMenuItemImage::create("upgradeTool/upgrade_tool_close_n_btn_394_1038.png", "upgradeTool/upgrade_tool_close_p_btn_394_1038.png", this, menu_selector(ChosePeopleLayer::shopClose));
        shopCloseBtn->setPosition(ccp(398, 1280-1025+shopHeight));
        
        for(int i=0; i<6; i++){
            
            int row = i/3;
            int col = i%3;
            
            if(i<5){
                CCSprite* moneyBg = CCSprite::create("shopLayer/money_bg_189_541.png");
                moneyBg->setPosition(ccp(189+206*col, 1280-541-277*row+shopHeight));
                shopLayer->addChild(moneyBg);
            
                char icon[100];
                sprintf(icon, "shopLayer/%d.png", (i+1));
                CCSprite* moneyIcon = CCSprite::create(icon);
                moneyIcon->setPosition(ccp(158+206*col, 1280-517-277*row+shopHeight));
                shopLayer->addChild(moneyIcon);
                
                textAddShadowAnchor(shopLayer, "x100", "STHupo", 40, 3, 100, 230+206*col, 1280-500-277*row+shopHeight, ccBLACK, 0.5, 0.5);
                
                LabelAtlas* labelAtlas = LabelAtlas::create();
                labelAtlas->setProperty("100:", "shopLayer/money_nums.png", 30, 42, "0");
                labelAtlas->setPosition(ccp(189+206*col, 1280-600-277*row+shopHeight));
                shopLayer->addChild(labelAtlas);
                
            }else{
                CCSprite* moneyBg = CCSprite::create("shopLayer/money_bg_free_605_828.png");
                moneyBg->setPosition(ccp(189+206*col, 1280-541-277*row+shopHeight));
                shopLayer->addChild(moneyBg);
            
                
            }
            
            CCMenuItem* buyBtn = CCMenuItemImage::create("shopLayer/buy_n_btn_186_671.png", "shopLayer/buy_n_btn_186_671.png", this, menu_selector(ChosePeopleLayer::buyMoney));
            buyBtn->setPosition(ccp(186+206*col, 1280-671-277*row+shopHeight));
            
            CCMenu* menuBuy = CCMenu::create(buyBtn, NULL);
            menuBuy->setPosition(CCPointZero);
            shopLayer->addChild(menuBuy);
        }
        
        CCMenu* menuShop = CCMenu::create(shopCloseBtn, NULL);
        menuShop->setPosition(CCPointZero);
        shopLayer->addChild(menuShop);
        
        addChild(shopLayer, 2);
        /************************shop layer end****************************/
        pRet = true;
    } while (0);
    
    return pRet;
}

void ChosePeopleLayer::pageViewEvent(CCObject *pSender, PageViewEventType type)
{
    switch (type)
    {
        case PAGEVIEW_EVENT_TURNING:
        {
            UIPageView* pageView = dynamic_cast<UIPageView*>(pSender);
            
            for(int i=0; i<PAGE_SUM_NUM; ++i)
            {
                if(i == pageView->getCurPageIndex())
                {
                    m_pImgLight[i]->loadTexture("chosePeopleLayer/chose_people_current_298_1103.png");
                }
                else
                {
                    m_pImgLight[i]->loadTexture("chosePeopleLayer/chose_people_no_current_298_1103.png");
                }
            }
        }
            break;
            
        default:
            break;
    }
}

void ChosePeopleLayer::menuBackCallback(){
    CCScene *scene = CCScene::create();
    scene->addChild(BeginLayer::create());
    CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(1, scene));
}

void ChosePeopleLayer::menuAddMoenyCallback(){
    menuPlay->setTouchEnabled(false);
    pageView->setVisible(false);
    
    upgradeLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, -height))));
}

void ChosePeopleLayer::upgradeClose(){
    menuPlay->setTouchEnabled(true);
    pageView->setVisible(true);

    upgradeLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, height))));
}

void ChosePeopleLayer::upgradeAddMoney(){
    
    upgradeLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, height))));
    shopLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, -shopHeight))));
}

void ChosePeopleLayer::shopClose(){
    
    shopLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, shopHeight))));
    upgradeLayer->runAction(CCEaseElasticOut::create(CCMoveBy::create(2, ccp(0, -height))));
}

void ChosePeopleLayer::buyMoney(cocos2d::CCObject *pSender)
{
    /*CCMenu *menu = (CCMenu*)((CCMenuItem*)pSender)->getParent();
    menu->setTouchEnabled(false);
    menu->setTouchEnabled(true);
    
    CCLog("NO CRASHES");*/
}

void ChosePeopleLayer::addChosePeople(UILayout* layout, int number, bool lockFlag){

    char bg[100];
    sprintf(bg, "chosePeopleLayer/%d/chose_people_bg.png", number);
    UIImageView* green = UIImageView::create();
    green->setTouchEnabled(true);
    green->setScale9Enabled(true);
    green->loadTexture(bg);
    green->setSize(CCSizeMake(348, 434));
    green->setAnchorPoint(ccp(0.5f, 0.5f));
    green->setPosition(ccp(400, 1280-572-60));
    layout->addChild(green);
    
    char peopleP[100];
    sprintf(peopleP, "chosePeopleLayer/%d/chose_people.png", number);
    UIImageView* people = UIImageView::create();
    people->setTouchEnabled(true);
    people->setScale9Enabled(true);
    people->loadTexture(peopleP);
    people->setSize(CCSizeMake(peopleSize[number][0], peopleSize[number][1]));
    people->setAnchorPoint(ccp(0.5f, 0.5f));
    people->setPosition(ccp(peoplePostions[number][0], 1280-peoplePostions[number][1]));
    layout->addChild(people);
    
    if(lockFlag){
        char black[100];
        sprintf(black, "chosePeopleLayer/%d/chose_people_black.png", number);
        UIImageView* peopleBlack3 = UIImageView::create();
        peopleBlack3->setTouchEnabled(true);
        peopleBlack3->setScale9Enabled(true);
        peopleBlack3->loadTexture(black);
        peopleBlack3->setSize(CCSizeMake(peopleBlackSize[number][0], peopleBlackSize[number][1]));
        peopleBlack3->setAnchorPoint(ccp(0.5f, 0.5f));
        peopleBlack3->setPosition(ccp(peoplePostions[number][0], 1280-peoplePostions[number][1]));
        layout->addChild(peopleBlack3);
    
    
    UIImageView* wen = UIImageView::create();
    wen->setTouchEnabled(true);
    wen->setScale9Enabled(true);
    wen->loadTexture("chosePeopleLayer/chose_people_wenhao_392_583.png");
    wen->setAnchorPoint(ccp(0.5f, 0.5f));
    wen->setSize(CCSizeMake(141, 244));
    wen->setPosition(ccp(392, 1280-583-60));
    layout->addChild(wen);
        
        }
    
    UIImageView* kuang = UIImageView::create();
    kuang->setTouchEnabled(true);
    kuang->setScale9Enabled(true);
    kuang->loadTexture("chosePeopleLayer/chose_people_kuang_400_554.png");
    kuang->setAnchorPoint(ccp(0.5f, 0.5f));
    kuang->setSize(CCSizeMake(422, 528));
    kuang->setPosition(ccp(400, 1280-554-60));
    layout->addChild(kuang);
    
    if(lockFlag){

    UIImageView* lock = UIImageView::create();
    lock->setTouchEnabled(true);
    lock->setScale9Enabled(true);
    lock->loadTexture("chosePeopleLayer/chose_people_lock_395_588.png");
    lock->setAnchorPoint(ccp(0.5f, 0.5f));
    lock->setSize(CCSizeMake(487, 132));
    lock->setPosition(ccp(395, 1280-588-60));
    layout->addChild(lock);
    }
}

/*
 给文字添加阴影，一看就懂的。。。
 *string         文本
 *fontName       文本字体类型
 *fontSize       文本大小
 *color3         文本颜色
 *shadowSize     阴影大小
 *shadowOpacity  阴影透明度
 */
void ChosePeopleLayer::textAddShadow(UILayout* layout, const char* string, const char* fontName, float fontSize, float shadowSize, float shadowOpacity, float x, float y, const ccColor3B &color3)
{
    UILabel* shadow = UILabel::create();
    shadow->setText(string);
    shadow->setFontName(fontName);
    shadow->setFontSize(fontSize);
    shadow->setPosition(ccp(x-shadowSize, y-shadowSize));
    shadow->setColor(color3);
    shadow->setOpacity(shadowOpacity);
    layout->addChild(shadow);
    
    UILabel* labelStar = UILabel::create();
    labelStar->setText(string);
    labelStar->setFontName(fontName);
    labelStar->setFontSize(fontSize);
    labelStar->setPosition(ccp(x, y));
    layout->addChild(labelStar);
}

void ChosePeopleLayer::textAddShadowAnchor(UIScrollView* layout, const char* string, const char* fontName, float fontSize, float shadowSize, float shadowOpacity, float x, float y, const ccColor3B &color3)
{
    UILabel* shadow = UILabel::create();
    shadow->setText(string);
    shadow->setFontName(fontName);
    shadow->setFontSize(fontSize);
    shadow->setAnchorPoint(ccp(0, 0));
    shadow->setPosition(ccp(x-shadowSize, y-shadowSize));
    shadow->setColor(color3);
    shadow->setOpacity(shadowOpacity);
    layout->addChild(shadow);
    
    UILabel* labelStar = UILabel::create();
    labelStar->setText(string);
    labelStar->setFontName(fontName);
    labelStar->setFontSize(fontSize);
    labelStar->setAnchorPoint(ccp(0, 0));
    labelStar->setPosition(ccp(x, y));
    layout->addChild(labelStar);
}

void ChosePeopleLayer::textAddShadowAnchor(CCLayer* layout, const char* string, const char* fontName, float fontSize, float shadowSize, float shadowOpacity, float x, float y, const ccColor3B &color3, float anX, float anY)
{
    UILabel* shadow = UILabel::create();
    shadow->setText(string);
    shadow->setFontName(fontName);
    shadow->setFontSize(fontSize);
    shadow->setAnchorPoint(ccp(anX, anY));
    shadow->setPosition(ccp(x-shadowSize, y-shadowSize));
    shadow->setColor(color3);
    shadow->setOpacity(shadowOpacity);
    layout->addChild(shadow);
    
    UILabel* labelStar = UILabel::create();
    labelStar->setText(string);
    labelStar->setFontName(fontName);
    labelStar->setFontSize(fontSize);
    labelStar->setAnchorPoint(ccp(anX, anY));
    labelStar->setPosition(ccp(x, y));
    layout->addChild(labelStar);
}

//滚动时触发的事件
void ChosePeopleLayer::scrollEvent(CCObject *pSender, ScrollviewEventType type){
    switch (type){
        case SCROLLVIEW_EVENT_SCROLL_TO_TOP:{
            CCLOG("SCROLLVIEW_EVENT_SCROLL_TO_TOP");
        }
            break;
        case SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM:{
            CCLOG("SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM");
        }
            break;
        case SCROLLVIEW_EVENT_SCROLL_TO_LEFT:
            CCLOG("SCROLLVIEW_EVENT_SCROLL_TO_LEFT");
            break;
        case SCROLLVIEW_EVENT_SCROLL_TO_RIGHT:
            CCLOG("SCROLLVIEW_EVENT_SCROLL_TO_RIGHT");
            break;
        case SCROLLVIEW_EVENT_SCROLLING:{
            CCLOG("SCROLLVIEW_EVENT_SCROLLING");
            UIScrollView* temp = (UIScrollView*)pSender;
            
            CCLOG("getInnerContainer::::::%f", fabs(temp->getInnerContainer()->getPositionY()));
            
            CCLOG("beforeOffset::::::%f", beforeOffset);
            
            if(temp->getInnerContainer()->getPositionY() != 0){
                float offset = 380*(temp->getInnerContainer()->getPositionY() - beforeOffset)/630;
                bar->runAction(CCMoveBy::create(0.1, ccp(0, -offset)));
                
                beforeOffset = temp->getInnerContainer()->getPositionY();
            }
            
            }
            break;
        case SCROLLVIEW_EVENT_BOUNCE_TOP:
            CCLOG("SCROLLVIEW_EVENT_BOUNCE_TOP");
            break;
        case SCROLLVIEW_EVENT_BOUNCE_BOTTOM:
            CCLOG("SCROLLVIEW_EVENT_BOUNCE_BOTTOM");
            break;
        case SCROLLVIEW_EVENT_BOUNCE_LEFT:
            CCLOG("SCROLLVIEW_EVENT_BOUNCE_LEFT");
            break;
        case SCROLLVIEW_EVENT_BOUNCE_RIGHT:
            CCLOG("SCROLLVIEW_EVENT_BOUNCE_RIGHT");
            break;
        default:
            break;
    }
}